<?
if($this->search=='0'){
	$searchValue="";
	$placeHolder='SEARCH USER';
}else{
	$searchValue=$this->search;
	$placeHolder='';
}
?>
<p  style="padding:0;line-height:0"><input type="text" id="search" name="search" value="<? echo $searchValue; ?>" placeholder="<? echo $placeHolder; ?>"><img  id="searchImageAdmin" src="<?php echo $basePath; ?>/images/social_media/invalid_link.png" onClick="Javascript:allUsers();"/></p>
<?php 
	$i=0;$j=0;
	foreach($this->getAllSearchUsers as $users){
		if($i==0){
			$j=0;
		?>
		<div id="users_<?echo $j;?>">
		<?}else{
			if($i%5==0){
				$j=$j+5;
			?>
			<div id="users_<?echo $j;?>">
			<?}
		}
		?>
		
			<p id="list_user_<? echo $users['user_id'];  ?>" class="search_user_pad">
				<a href="javascript:void(0)" onClick="Javascript:viewUserBoxes(<? echo $users['user_id'];  ?>);"><? echo $users['display_name']?></a>
			</p>
		<?
		$i++;
		if($i%5==0){
		?>
		</div>
		<?
		}
	}
?>
<script>
function allUsers(){
	$("#search").val("");
	$.ajax({
		  url: BASE_URL+"/admin/search-ajax-users",
		  type: "POST",
		  data:{search:0},
		  success: function(data) {
			$('.users_ajax').html(data);
			$('#searchValue').val(1);
			$('#lastDiv').val(0);
			$('#searchImageAdmin').attr('src',BASE_PATH+'/images/go_search_btn.png');
			$('#searchImageAdmin').attr('onclick','Javascript:searchUsers();');
		  }
	});
}
$("#search").keyup(function(){
	if($("#search").val()!=""){
		$('#searchImageAdmin').attr('src',BASE_PATH+'/images/go_search_btn.png');
		$('#searchImageAdmin').attr('onclick','Javascript:searchUsers();');
	}else{
		allUsers();
	}
});
</script>
